﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Legend.Guarding;

namespace Legend
{
    /// <summary>
    /// Provides a fluent interface for guarding method-arguments.
    /// </summary>
    public static class Require
    {
        /// <summary>
        /// Gets an object where requirements for the argument can be set, the argument
        /// is then validated to meet these requirements or an exception is thrown.
        /// </summary>
        /// <typeparam name="T">The type of argument to guard.</typeparam>
        /// <param name="argument">The argument to guard.</param>
        /// <returns>An object where requirements for the argument can be set.</returns>
        public static ArgumentInfo<T> ThatArgument<T>(T argument)
        {
            return new ArgumentInfo<T>(argument);
        }

        /// <summary>
        /// Gets an object where requirements for the argument can be set, the argument
        /// is then validated to meet these requirements or an exception is thrown.
        /// </summary>
        /// <typeparam name="T">The type of argument to guard.</typeparam>
        /// <param name="argumentName">The name of the argument</param>
        /// <param name="argument">The argument to guard.</param>
        /// <returns>An object where requirements for the argument can be set.</returns>
        public static ArgumentInfo<T> ThatArgument<T>(T argument, string argumentName)
        {
            return new ArgumentInfo<T>(argument).Named(argumentName);
        }
    }
}